﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Text;
using System.Text.RegularExpressions;
using XNode;
public abstract class BaseNode : Node 
{
    //abstract public void Trigger();
    //[Input(backingValue = ShowBackingValue.Always)]
    //public BaseNode upLink;
    //[Output(backingValue = ShowBackingValue.Always)]
    //public BaseNode downLink;
   
    //public bool isFront = false;
    //public bool contentList = false;
    //public bool condition = false;

    public override object GetValue(NodePort port)
    {
        return null;
    }
    public virtual StringBuilder ToTable()
    {
        return null;
    }
    protected int GetStoryID(string str)
    {
        int result = -1;
        if (str != null && str != string.Empty)
        {
            // 正则表达式剔除非数字字符（不包含小数点.）
            str = Regex.Replace(str, @"[^\d.\d]", "");
            // 如果是数字，则转换为decimal类型
            if (Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$"))
            {
                result = int.Parse(str);
            }
        }
        return result;
    }
    protected int GetStoryIndex()
    {
        int Index = 1;
        for (int i = 0; i < graph.nodes.Count; i++)
        {
            StoryVoNode node = graph.nodes[i] as StoryVoNode;
            if (node != null)
            {
                Index += 1;
            }
        }
        return Index;
    }
}
